package oocl.ita.eordering.dao.impl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import oocl.ita.eordering.dao.MerchantDao;
import oocl.ita.eordering.po.Merchant;

@Repository
public class MerchantDaoImpl implements MerchantDao {
	@PersistenceContext(name = "un")
	private EntityManager em;

	@Override
	public List<Merchant> findAllMerchant() {
		String jpql = "from Merchant";
		@SuppressWarnings("unchecked")
		List<Merchant> ls = em.createQuery(jpql).getResultList();
		if (ls.isEmpty())
			return null;
		else
			return ls;
	}

}
